package org.db2.project.airline.model;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import java.io.Serializable;

/**
 * The persistent class for the FLIGHTROUTE database table.
 */
@Entity
public class FlightRoute implements Serializable {
    private static final long serialVersionUID = 1L;

    @Id
    @SequenceGenerator(name = "FLIGHTROUTE_ID_GENERATOR", sequenceName = "FLIGHTROUTE_SEQ")
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "FLIGHTROUTE_ID_GENERATOR")
    private long id;

    private long distance;

    //bi-directional many-to-one association to Airport
    @ManyToOne
    @JoinColumn(name = "DESTINATIONAIRPORTID")
    private Airport destinationAirport;

    //bi-directional many-to-one association to Airport
    @ManyToOne
    @JoinColumn(name = "DEPARTUREAIRPORTID")
    private Airport departureAirport;

    public FlightRoute() {
    }

    public long getId() {
        return this.id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public long getDistance() {
        return this.distance;
    }

    public void setDistance(long distance) {
        this.distance = distance;
    }

    public Airport getDestinationAirport() {
        return this.destinationAirport;
    }

    public void setDestinationAirport(Airport destinationAirport) {
        this.destinationAirport = destinationAirport;
    }

    public Airport getDepartureAirport() {
        return this.departureAirport;
    }

    public void setDepartureAirport(Airport departureAirport) {
        this.departureAirport = departureAirport;
    }

}